import time
import pyctptdif
import structs

#must call reg_struct and profile before receive
pyctptdif.reg_struct(structs)
i = pyctptdif.profile('./ctpif.conf')
print 'get configure file result is', i

result = pyctptdif.start()
print i

#query instruments       
pyctptdif.query_instr(instrument) #instrument should be None

#query account
pyctptdif.query_account()

#query investor's position
pyctptdif.query_invpos(instrument) #instrument should be None

#query order, if argumens are all None, return all order
pyctptdif.query_order(instrument, exchange, ordersysid, begintime, endtime)

#query trade, if argumens are all None, return all trade
pyctptdif.query_trade(instrument, exchange, tradeid, begintime, endtime)

#insert limited order
pyctptdif.order_insert_limitd(instrument, cDirection, fPrice, nVolume)

#insert condition order
pyctptdif.order_insert_condtn(instrument, cDirection, fPrice, nVolume, fConditionPrice, cTrigerCondition, cPriceCondition)

#corver condition order
pyctptdif.order_corver_condtn(instrument, cDirection, fPrice, nVolume, fConditionPrice, cTrigerCondition, cPriceCondition)

#corver order       
pyctptdif.order_corver(instrument, cDirection, fPrice, nVolume)

#recall order 
pyctptdif.order_recall       ()

#order status, reserved for now
pyctptdif.order_status       ()

result = pyctptdif.stop()

